<template>
    <el-dialog width="58%" :title="title" :visible.sync="visible">
        <el-form ref="form" :model="model" :disabled="true" label-width="160px" size="small" v-loading="loading">
          <el-row>
            <el-col :span="12">
                <el-form-item prop="contractNamber" label="合同编号">
                    <el-input placeholder="请输入合同编号" v-model="model.contractNamber"></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="batch" label="批次">
                <el-input placeholder="请输入批次" v-model="model.batch"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
                <el-form-item prop="name" label="资产名称">
                    <el-input placeholder="请输入资产名称" v-model="model.name"></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="model" label="规格型号">
                <el-input placeholder="请输入规格型号" v-model="model.model"></el-input>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="12">
                <el-form-item prop="classes" label="资产大类">
                    <el-input placeholder="请输入资产大类" v-model="model.classes"></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="classesId" label="资产分类ID">
                <el-input placeholder="请输入资产分类ID" v-model="model.classesId"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item prop="typeName" label="分类名称">
                  <el-input placeholder="请输入分类名称" v-model="model.typeName"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="code" label="分类编码">
                <el-input placeholder="请输入分类编码" v-model="model.code"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
                <el-form-item prop="companyId" label="公司Id">
                    <el-input placeholder="请输入公司Id" v-model="model.companyId"></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="companyName" label="领用公司名称">
                <el-input placeholder="请输入领用公司名称" v-model="model.companyName"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
                <el-form-item prop="receiver" label="领用人">
                    <el-input placeholder="请输入领用人" v-model="model.receiver"></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="telphone" label="联系电话">
                <el-input placeholder="请输入联系电话" v-model="model.telphone"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="入库日期" prop="inDate">
                <el-date-picker
                  v-model="model.inDate" type="date" style="width: 100%;" placeholder="选择入库日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="资产使用时间" prop="startUsetime">
                <el-date-picker
                  v-model="model.startUsetime" style="width: 100%;" type="date"  placeholder="选择资产使用时间">
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item prop="unit" label="计量单位">
                <el-input placeholder="请输计量单位" v-model="model.unit"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="price" label="价格（元）">
                <el-input-number controls-position="right" :precision="2" :step="0.1" placeholder="请输入价格" v-model="model.price"></el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>

            <el-col :span="12">
              <el-form-item prop="buyer" label="购买单位">
                <el-input placeholder="请输入购买单位" v-model="model.buyer"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="manufacturer" label="供应商">
                <el-input placeholder="请输入购买单位" v-model="model.manufacturer"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item prop="isFixed" label="是否属于固定资产">
                <el-switch v-model="model.isFixed"></el-switch>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="isFax" label="是否含税">
                  <el-switch v-model="model.isFax"></el-switch>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="使用期限" prop="usefulLife">
                <el-date-picker
                  v-model="model.usefulLife" style="width: 100%;" type="date"  placeholder="选择使用期限">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="state" label="资产状态">
                <el-select v-model="model.state" placeholder="请选择">
                  <el-option :key="1" label="闲置" :value="1"></el-option>
                  <el-option :key="2" label="已领用" :value="2"></el-option>
                  <el-option :key="3" label="已处置" :value="3"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item prop="depreciation" label="折旧率">
                <el-input placeholder="请输入折旧率" v-model="model.depreciation"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="depreciationWay" label="折旧方式">
                <el-select v-model="model.depreciationWay" placeholder="请选择">
                  <el-option :key="1" label="年限平均法" :value="1"></el-option>
                  <el-option :key="2" label="工作量法" :value="2"></el-option>
                  <el-option :key="3" label="双倍余额递减法" :value="3"></el-option>
                  <el-option :key="4" label="年数总和法" :value="4"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item prop="depreciationMonth" label="折旧总月数">
                <el-input placeholder="请输入折旧总月数" v-model="model.depreciationMonth"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item prop="useState" label="使用状态">
                <el-select v-model="model.useState" placeholder="请选择">
                  <el-option :key="1" label="正常使用" :value="1"></el-option>
                  <el-option :key="2" label="损坏" :value="2"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="处置时间" prop="disDate">
                <el-date-picker
                  v-model="model.disDate" style="width: 100%;" type="date"  placeholder="选择处置时间">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="归还时间" prop="dueDate">
                <el-date-picker
                  v-model="model.dueDate" style="width: 100%;" type="date"  placeholder="选择归还时间">
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
          
    </el-dialog>
</template>

<script>

  import Vue from 'vue'
  import { MessageBox, Message,Notification } from 'element-ui'
  import pick from 'lodash.pick'
  import { ACCESS_TOKEN } from "@/store/mutation-types"
  import ImageUpload from "@/components/ImageUpload"
  import { getAction,deleteAction,putAction,postAction } from '@/api/manage'

  export default {
    name: "depAssetModal",
    components: {
      ImageUpload
    },
    data () {
      return {
        title:"查看",
        visible: false,
        loading:false,
        model: {},
        url: {

        },  // 新增资产表单验证
      }
    },
    created () {
      const token = Vue.ls.get(ACCESS_TOKEN);
      this.headers = {"X-Access-Token":token}

    },
    methods: {
      edit (record) {
        let that = this;
        this.visible = true;
        if(that.$refs.form){
          that.$refs.form.resetFields();
          that.model = Object.assign({}, record);
        }else{
          this.$nextTick(() => {
            that.$refs.form.resetFields();
            that.model = Object.assign({}, record);
          })
        }
      }
    }
  }
</script>

<style scoped>

</style>
